<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
	body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=w8oGgSbRvxoXuHdRSpTe2HwsUoDMj8cS"></script>

	<title>地图展示</title>
	<title>显示全景控件</title>
	<title>IP定位获取当前城市</title>
</head>
<body>
	<div id="allmap"></div>
	<p>在地图上添加全景控件，点击全景控件进入全景图</p>
	
	
	</div>
</body>
</html>
<script type="text/javascript">


	
var map;
var nowpoint;
	// 百度地图API功能
	
//	function initmap(){
	 map = new BMap.Map("allmap");    // 创建Map实例
	map.centerAndZoom(new BMap.Point(106.5569552788, 29.5889989866), 18);  // 初始
	map.enableScrollWheelZoom();                 //启用滚轮放大缩小
//	}
map.enableScrollWheelZoom(true);
	// 覆盖区域图层测试
	map.addTileLayer(new BMap.PanoramaCoverageLayer());

	var stCtrl = new BMap.PanoramaControl(); //构造全景控件
	stCtrl.setOffset(new BMap.Size(20, 20));
	map.addControl(stCtrl);//添加全景控件
	/*
	//清除覆盖物
	function remove_overlay(){
		map.clearOverlays();         
	}
	
	*/

function theFun2(valuel1,valuel2){

	//创建点坐标
		var nowpoint = new BMap.Point(valuel1,valuel2);
		map.panTo( nowpoint);	
		alert('广州.'); //这是弹出一个消息框
	}
	
	function theFun(){
	var jing = document.getElementById( "JingInput" ).value;
	var wei = document.getElementById( "WeiInput" ).value;

	var nowpoint = new BMap.Point(wei,jing);
	map.panTo( nowpoint );	
	}
	
	//按关键字搜索
    function Search (valuel){

	//本地搜索
			var local = new BMap.LocalSearch(map, {
		renderOptions:{map: map}
	});
	local.search(valuel);
	
	}

	//步行导航
	function theFun3(valuel1,valuel2)
	{
		//remove_overlay();
		var walking = new BMap.WalkingRoute(map, {renderOptions:{map: map, autoViewport: true}});
		walking.search(valuel1,valuel2);

	}

	//驾车导航
	function theFun4(valuel1,valuel2)
	{
		//remove_overlay();
		var driving = new BMap.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}});
		driving.search(valuel1, valuel2);
		//GetALLPoint();
		//return points;
	}
	function myFun(result){
		var cityName = result.name;
		map.setCenter(cityName);
		alert("当前定位城市:"+cityName);
	}
	var myCity = new BMap.LocalCity();
	myCity.get(myFun);

	
</script>

